package Demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2022-10-10
 * Time: 12:34
 *
 * */
class Animal{
    public String name;
    public String c;
    public Animal(String name,String c){
        this.name = name;
        this.c = c;
    }
    public void eat(String some){
        System.out.println("吃"+some);
    }
}
class Dog extends Animal{
    public Dog(String name,String c){
        super(name,c);
    }
    @Override
    public void eat(String some) {
        System.out.println(this.name + "吃"+some);
    }
    public void LookHome(){
        System.out.println("看家");
    }
}
class Cat extends Animal{
    public Cat(String name,String c){
        super(name,c);

    }

    @Override
    public void eat(String some) {
        System.out.println(this.name+ "吃"+some);
    }
    public void catMouse(){
        System.out.println("捉老鼠");
    }
}
class Preson{
    public int age;
    public String name;
    public Preson(String name,int age){
        this.name = name;
        this.age = age;
    }
    public void keepPet(Animal a,String some){
        a.eat(some);
    }
}
public class Test {
    public static void main(String[] args) {
        Preson p = new Preson("老王",30);
        p.keepPet(new Dog("大飞","黑"),"骨头");
        p.keepPet(new Cat("白糖","白"),"鱼");
    }
}
